﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Signup.aspx.cs" Inherits="ZLCMS.Web.Wap.Member.Signup"  MasterPageFile="~/Wap/Shop/ShopSite.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">    
    <title>注册帐号</title>
    <link rel="stylesheet" href="/wap/lib/validator-0.7.0/css/jquery.validator.css" />
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/jquery.validator.js"></script>
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/local/zh_CN.js"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
    <div data-role="page" id="mypage">
        <div role="main" class="ui-content">
            <!--s login-->
            <div id="login">
        	    <form id="Form1" command="Member.SignupPhone">
            	    <div class="loginLIST">
                	    <div class="left"><img src="/wap/shop/images/icon_phone.png"></div>
                        <div class="right"><input type="tel" name="telephone" id="telephone" placeholder="手机号码" command-param='Phone'
                            data-rule="required;mobile" /></div>
                    </div>
                    <div class="loginLIST YZM">
                	    <div class="left"><img src="/wap/shop/images/icon_yanzm.png"></div>
                        <div class="center">
                    	    <div class="inputtext"><input type="tel" name="checkcode" id="Tel2" placeholder="验证码" command-param='CheckCode'
                                    data-rule="required;digits" /></div>
                            <div class="textlink"><input type="button" value="发送验证码" class="sendinput" onclick="SendMsg(this)"></div>
                        </div>
                    </div>
                    <div class="loginLIST">
                	    <div class="left"><img src="/wap/shop/images/icon_password.png"></div>
                        <div class="right"><input type="password" name="password" id="password1" placeholder="密码" command-param='Password'
                            data-rule="密码: required;"></div>
                    </div>
                    <div class="loginLIST">
                	    <div class="left"><img src="/wap/shop/images/icon_password1.png"></div>
                        <div class="right"><input type="password" name="passwordc" id="password2" placeholder="确认密码"
                            data-rule="required;match(password)"></div>
                    </div>
                    
                
                    <div class="button">
                	    <a href="javascript:void(0);" data-role="button" data-theme="o" data-shadow="false" onclick="executeFormCommonCommand('Form1', signupOk)">立即注册</a>
                    </div>
                    <div class="text">
                	    <a href="Login.aspx?goto=<%=Server.UrlEncode(Request["goto"]) %>" data-ajax="false">已有账号，直接登录？</a>
                    </div>
                </form>
            </div>
            <!--s login-->
  
        </div>
    </div>


    <!-- /content -->
    <script type="text/javascript">
        function signupOk(result) {
            showTips("注册成功", 500, function () {
                location.href = 'LoginSuccess.aspx?token=' + result.Token + '&goto=<%=Server.UrlEncode(Request["goto"]) %>';
            });

        }

        function SendMsg(ct) {
            if ($.trim($("#telephone").val()) == "") {
                showTips("请输入手机号码");
                return;
            }
            var myReg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            if (!myReg.test($("#telephone").val())) {
                showTips("请输入有效的手机号码！");
                return false;
            }
            $(ct).executeCommand({
                successCallBack: function (result) {
                    if (result) {
                        if (result.Status == 1) {
                            showTips("验证码发送成功，请注意查收。");
                            $(ct).button({ disabled: true });
                            var counter = 60;
                            var timer = setInterval(function () {
                                if (counter > 0) {
                                    $(ct).val(counter + "秒后重发");
                                    $(ct).button("refresh");

                                    counter--;
                                }
                                else {
                                    $(ct).val("发送验证码");
                                    $(ct).button("refresh");
                                    $(ct).button({ disabled: false });
                                    clearInterval(timer);
                                }
                            }, 1000);
                        }
                        else {
                            showTips("发送验证码失败");
                        }
                    }
                },
                errorCallback: function (errorCode, msg) {
                    showTips(msg);
                }
            }, 'Pub.SendCheckCode', { Phone: $.trim($("#telephone").val()) });
        }
    </script>
</asp:Content>
